package com.cat.dataStructure;

import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.stream.IntStream;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/smallest-number-in-infinite-set/description/
 * @create 2025/9/19 21:18
 * @since JDK17
 */

public class SmallestInfiniteSet {
    PriorityQueue<Integer> pq = new PriorityQueue<>();

    public SmallestInfiniteSet() {
        IntStream.range(1, 1001).forEach(i -> pq.add(i));
    }

    public int popSmallest() {
        return pq.poll();
    }

    public void addBack(int num) {
        if (!pq.contains(num)) {
            pq.add(num);
        }
    }
}
